﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace MasterListCreator.Classes
{
    static class PublicParam
    {
        #region EXCEL PARAM
        /// <summary>
        /// Start Col To Export.
        /// </summary>
        public static int START_COL = int.Parse(ReadConfig(PublicName.START_COL));
        
        /// <summary>
        /// Start Row to Export. 
        /// </summary>
        public static int START_ROW = int.Parse(ReadConfig(PublicName.START_ROW));

        /// <summary>
        /// Output File Name. 
        /// </summary>
        public static string FILE_NAME = ReadConfig(PublicName.FILE_NAME);

        /// <summary>
        /// Absolute|Relative|RelativeOrAbsolute
        /// 0|1|2
        /// Default: Absolute|0
        /// </summary>
        public static string URI_KIND = ReadConfig(PublicName.URL_KIND);

        /// <summary>
        /// Maximum level to call recursive
        /// </summary>
        public static int MAX_LEVEL = int.Parse(ReadConfig(PublicName.MAX_LEVEL));

        /// <summary>
        /// Export file or not.
        /// </summary>
        public static bool EXPORT_FILE = (ReadConfig(PublicName.EXPORT_FILES).ToString() == "1" ? true : false);

        /// <summary>
        /// Export Empty Directort.
        /// </summary>
        public static bool EXPORT_EMPTY_DIR = (ReadConfig(PublicName.EXPORT_EMPTY_DIR).ToString() == "1" ? true : false); 
        #endregion

        /// <summary>
        /// Read Application Config.
        /// </summary>
        /// <param name="key">Key to read.</param>
        /// <returns>Value of Key.</returns>
        public static string ReadConfig(string key)
        {
            if (!ConfigurationManager.AppSettings.HasKeys())
            {
                return string.Empty;
            }

            return ConfigurationManager.AppSettings[key];
        }        
    }
}
